package Exception;


import java.io.FileOutputStream;
import java.io.IOException;

public class AutoCloseableDemo {
    public static void main(String[] args) {
        //实现了AutoClose接口的类才可以在这定义
        try(FileOutputStream file = new FileOutputStream("note3.txt");)
        {
            file.write(123456);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
